<?php include_partial('aoiFrontPartials/contentHeader',
	array(
		'nav'=>array(
			array('url'=>url_for('homepage'),'title'=>'Accueil'),
			array('url'=>'','title'=>'R&eacute;servations')
		),
		'title'=>'R&eacute;servations',
		'description'=>'Votre prochain voyage avec Comoros Airways'
	)
);
?>

<section id="content">
	<div class="container">
		<div id="mainbody">
			<div class="row">
				<div class="span12">
					<form method="GET" action="<?php echo url_for('booking_confirm')?>">
						<input type="hidden" name="flight_type" value="<?php echo $flight_type ?>"/>
						<input type="hidden" name="origin_airport" value="<?php echo $origin_airport ?>"/>
						<input type="hidden" name="destination_airport" value="<?php echo $destination_airport ?>"/>
						<?php foreach($passengers->getRawValue() as $key=>$val): ?>
						<input type="hidden" name="passengers[]" value="<?php echo $val ?>"/>
						<?php endforeach; ?>

						<h1 class="page-title">Vols disponibles pour votre recherche</h1>

						<h2>Vol aller</h2>

						<p>Les r&eacute;sultats comportent les vols disponibles les plus proches de la date que vous avez s&eacute;l&eacute;ctionn&eacute;e.</p>
						
						<div>
							<?php include_partial('aoiFrontPartials/bookingProcessFlightList', array('flights'=>$go_flights,'input_name'=>'flight_go','date_wanted'=>$date_go,'places_wanted'=>$places_wanted)) ?>
						</div>

						<?php if($flight_type == 'go-back'): ?>

						<hr class="bs-docs-separator">

						<h2>Vol retour</h2>

						<p>Les r&eacute;sultats comportent les vols disponibles les plus proches de la date que vous avez s&eacute;l&eacute;ctionn&eacute;e.</p>
						
						<div>
							<?php include_partial('aoiFrontPartials/bookingProcessFlightList', array('flights'=>$back_flights,'input_name'=>'flight_back','date_wanted'=>$date_back,'places_wanted'=>$places_wanted)) ?>	
						</div>

						<?php endif; ?>

						<hr class="bs-docs-separator">

						<input type="submit" class="btn btn-large btn-success right" value="Je r&eacute;serve mon vol"/>
					
					</div>
				</form>
			</div><!-- end grid span12 -->
		</div><!-- end row -->
			
		</div><!-- end mainbody -->
		
	</div><!-- end container -->
</section>
<script>
	$('.table-list-select').each(function(){
		var table = $(this);
		var list = $('tr',table);
		list.each(function(){
			$(this).click(function(){
				if($(this).hasClass('disabled'))
				{
					alert('Il n\'y a plus de disponibilités pour ce vol');
					return false;
				}
				list.removeClass('selected');
				$('input[type="radio"]',list).removeAttr('checked');
				$(this).addClass('selected');
				$('input[type="radio"]',this).attr('checked','checked');
			});
		});
	})
</script>